package com.bishe.tax.service;

import com.bishe.tax.entity.Ledger;
import com.bishe.tax.mapper.LedgerMapper;
import com.bishe.tax.utils.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 账薄 服务层实现
 *
 * @author ruoyi
 * @date 2019-06-23
 */
@Service
public class LedgerService {
	@Autowired
	private LedgerMapper ledgerMapper;

	/**
	 * 查询账薄信息
	 *
	 * @param ledgerId
	 *            账薄ID
	 * @return 账薄信息
	 */
	public Ledger selectLedgerById(Integer ledgerId) {
		return ledgerMapper.selectLedgerById(ledgerId);
	}

	/**
	 * 查询账薄列表
	 *
	 * @param ledger
	 *            账薄信息
	 * @return 账薄集合
	 */
	public List<Ledger> selectLedgerList(Ledger ledger) {
		return ledgerMapper.selectLedgerList(ledger);
	}

	/**
	 * 新增账薄
	 *
	 * @param ledger
	 *            账薄信息
	 * @return 结果
	 */
	public int insertLedger(Ledger ledger) {
		return ledgerMapper.insertLedger(ledger);
	}

	/**
	 * 修改账薄
	 *
	 * @param ledger
	 *            账薄信息
	 * @return 结果
	 */
	public int updateLedger(Ledger ledger) {
		return ledgerMapper.updateLedger(ledger);
	}

	/**
	 * 删除账薄对象
	 *
	 * @param ids
	 *            需要删除的数据ID
	 * @return 结果
	 */
	public int deleteLedgerByIds(String ids) {
		return ledgerMapper.deleteLedgerByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除账薄对象
	 *
	 * @param ids
	 *            需要删除的数据ID
	 * @return 结果
	 */
	public List<Map<String, Object>> selectLedgerStatistics(String name) {
		return ledgerMapper.selectLedgerStatistics(name);
	}

	public List<Map<String, Object>> selectLedgerByModel(Integer taxpayerId) {
		return ledgerMapper.selectLedgerByModel(taxpayerId);
	}

	public List<Map<String, Object>> selectLedgerByDay(Integer taxpayerId) {
		return ledgerMapper.selectLedgerByDay(  taxpayerId);
	}
}
